bash isn't Perl

Mr. Muskrat on 2004-09-08T19:41:27

Can you find my mistake?

#!/bin/bash
today = $(date +%Y-%m-%d)
echo $today

It took me a few minutes to realize what I had done.


bash=perl

runrig on 2004-09-08T21:11:44

s/\s*=\s*//;
I still get caught by that in ksh. My other favorite shell mistake:
$var="value"

Re:bash=perl

runrig on 2004-09-08T21:13:03

Oops, make that:
s/\s*=\s*/=/;

Re:bash!=perl

runrig on 2004-09-08T21:16:59

And the title was supposed to be bash => perl, but it may as well be the above. I should take more time to review my posts before I post :-)

Re:bash=perl

Mr. Muskrat on 2004-09-08T23:16:04

Yep. I often find myself adding whitespace where it doesn't belong. I should be able to spot these mistakes immediately after this many times. :)